
<form id="formLogin" method="POST">
	<table>
		<tr><td></td><td><input required="" type="hidden" value="true" name="akses"></td></tr>
		<tr><td>Username</td><td><input required="" type="text" name="username"></td></tr>
		<tr><td>Password</td><td><input required="" type="password" name="password"></td></tr>
		<tr><td></td><td><input required="" type="submit" value="Masuk"></td></tr>
	</table>
</form>
<script type="text/javascript" >
	$("#formLogin").submit(function(e){	
		var a=$('#formLogin').serialize();
		$.ajax({
			type: "POST", 
			async: false, 
			url: 'checklogin.php',   
			data : a ,
			success: function(a){			
				if(a == 'true'){
					alert('Sukses login');	
					return true;
				} else {
					alert('Maaf password atau username anda salah.');
					return false;
				}
				$("#loading").hide();
				return false;
			},
			error: function(){
				var obj = jQuery.parseJSON(a);
				alert(obj+"error");	
				$("#loading").hide();
				return false;
			}
		}); 
	});
</script>
